package com.niuxiaofa.newlaw.adapter;

import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.niuxiaofa.newlaw.Bean.InviteBean;
import com.niuxiaofa.newlaw.R;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;


public class MyClassAdapter extends RecyclerView.Adapter<MyClassAdapter.ViewHolder> {
    public List<InviteBean.DataDTO.PageDTO.RecordsDTO> listEntities;
    Onclick onclick;

    int postion = 0;

    public MyClassAdapter(List<InviteBean.DataDTO.PageDTO.RecordsDTO> newsList, Onclick onclick) {
        this.onclick = onclick;
        this.listEntities = newsList;
    }


    @Override
    public ViewHolder onCreateViewHolder( ViewGroup viewGroup, int i) {
        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_myclass, viewGroup, false);
        ViewHolder viewHolder = new ViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder( ViewHolder viewHolder, int i) {

        InviteBean.DataDTO.PageDTO.RecordsDTO listEntity = listEntities.get(i);

        viewHolder.user_name.setText(listEntity.getUserName());

        viewHolder.inviteTime.setText(listEntity.getInviteTimeStr());



    }

    @Override
    public int getItemCount() {
        return listEntities.size();
    }

    public interface Onclick {

        void onclick(int c);

    }

    static class ViewHolder extends RecyclerView.ViewHolder {


        @BindView(R.id.name)
        TextView name;


        @BindView(R.id.user_name)
        TextView user_name;


        @BindView(R.id.inviteTime)
        TextView inviteTime;


        public ViewHolder( View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
